
//$("#loginBtn").prop("disabled","disabled");
$(document).keypress(function(e) {
    var eCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
    if (eCode == 13){
			login()
		}
});
$("#loginBtn").click(function(e){
		e.preventDefault();
		login()
});
function login(){
	var username = $("#username").val();
	var password = $("#password").val();

$.ajax({
	type: "post",
	// url: "http://www1.wuyoutianxia.com/wy3pt/admin/open/adminLogin",
	url: "http://ww.wuyoutianxia.com/wy3pt/admin/open/adminLogin",
	// url: "http://192.168.0.118/watw/admin/open/adminLogin",
	data: {
		'adminName': username,
		'adminPassword': md5(password)
	},
	dataType: "json",
	success: function(result){
		layer.msg(result.msg);
		// console.log(result);
		if(result.code == "200"){
			layer.msg("登陆成功");
			var navData = JSON.stringify(result.data);
			console.log(navData)
			$.cookie("navData",navData)
			// $.cookie('navData', navData, {expires: 1});
			$.cookie("navData", navData,{expires:7});
			$.cookie("navData", navData,{path:"/"});
			// window.location.href =  'user.html';
			window.location.href = result.data.limitUrl;
			console.log($.cookie("navData"));
		}
	},
	error: function(err){
		console.log(err.status);
	}
});
}
